﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.OracleClient;

namespace OracleDAL.ElecBoss
{
    public class AddDutyImp
    {
        public int addAndUpdate(string id, string userisn, string content, string type)
        {
            int result = 0;
            string strSql = "";
            try
            {
                if (type == "1")
                {
                    strSql = "insert  into duty_import (id,userisn,impcontent,inputtime) values('"+id+"','"+userisn+"','"+ content +"',sysdate)";
                    result = DBUtility.OracleHelper.ExecuteSql(strSql);
                
                }
                else if (type == "2")
                {
                    strSql = "update duty_import set impcontent='"+ content +"' where id='"+ id +"'";
                    result = DBUtility.OracleHelper.ExecuteSql(strSql);
                
                }  
            }
            catch (Exception e)
            { 
            
            }
            return result;
        }
        public string getContent(string id)
        {
            string content = "";
            string strSql = "select impcontent from duty_import where id='"+id+"'";
            OracleDataReader  read = DBUtility.OracleHelper.ExecuteReader(strSql);
            while (read.Read())
            {
                content = read["IMPCONTENT"].ToString();
            }
            return content;
        }
        public int delImp(string id)
        {
            int result = 0;
            string strSql = "delete duty_import where id='"+ id +"'";
            try
            {
                result = DBUtility.OracleHelper.ExecuteSql(strSql);
            }
            catch (Exception e)
            { }
            return result;
        }
    }
}
